/*
 * TODO
 */
package com.xtrip.util;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * @project xtrip
 * @author shiming.yao
 * @time 2013-6-3
 */
public class XtripIoUtils {

	public static String readFile(String fileName){
		StringBuffer sb = new StringBuffer();
		InputStream is = XtripIoUtils.class.getClassLoader().getResourceAsStream(fileName);
		BufferedReader br = new BufferedReader(new InputStreamReader(is));
		String line = "";
		try {
			while((line = br.readLine()) != null){
				sb.append(line);
			}
		} 
		catch (FileNotFoundException e) 
		{
			System.out.println("无法找到请求文件"+fileName);
		}
		catch(IOException e)
		{
			System.out.println("无法找到请求文件"+fileName);
		}
		finally
		{
			try {
				is.close();
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
}
